//
//  NSDictionary+String2Dic.m
//  MyApp
//
//  Created by Don on 2017/8/29.
//  Copyright © 2017年 com.memego. All rights reserved.
//

#import "NSDictionary+JsonString2Dic.h"

@implementation NSDictionary (JsonString2Dic)
+ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString {
    if (jsonString == nil) {
        return nil;
    }
    NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
    NSError *err;
    NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData
                                                        options:NSJSONReadingMutableContainers
                                                          error:&err];
    if(err) {
        DLog(@"json解析失败：%@",err);
        return nil;
    }
    return dic;
}
@end
